import java.util.*;
public class Between extends Hint{

	public Between(){
	}
	
	public Between(Unit[] units){
		super(units);
	}
	
	public void applyHint(){
		applyHint(units[0], units[1], units[2]);
	}
	
	public void applyHint(Unit A, Unit B){
	}
	
	public void applyHint(Unit A, Unit B, Unit C){
		Unit result1;
		Unit result2;
		Unit tmpA = (Unit) A.clone();
		Unit tmpC = (Unit) C.clone();
		
		result1 = (Unit) A.cloneShiftLeft();
		result1.and((Unit) C.cloneShiftRight());
		result1.and(B);
		
		result2 = (Unit) C.cloneShiftLeft();
		result2.and((Unit) A.cloneShiftRight());
		result2.and(B);
		
		A.and((Unit)result1.cloneShiftRight());
		tmpA.and((Unit)result2.cloneShiftLeft());
		A.or(tmpA);
		
		C.and((Unit)result2.cloneShiftRight());
		tmpC.and((Unit)result1.cloneShiftLeft());
		C.or(tmpC);
		
		result1.or(result2);
		B.and(result1);
	}
	
	public boolean checkHint(){
		return checkHint(units[0], units[1], units[2]);
	}
	
	public boolean checkHint(Unit A, Unit B){
		return false;
	}
	
	public boolean checkHint(Unit A, Unit B, Unit C){
		Unit tmpA = (Unit) A.clone();
		Unit tmpB = (Unit) B.clone();
		Unit tmpC = (Unit) C.clone();
		applyHint(tmpA, tmpB, tmpC);
		if(tmpA.isEmpty() || tmpB.isEmpty() || tmpC.isEmpty()){
			return false;
		}else{
			return true;
		}
	}
	
	public String toString(){
		return ""+units[0].getSymbol()+units[1].getSymbol()+units[2].getSymbol();
	}
}